package com.focus.xyz.mobile.pages;

import com.focus.xyz.core.common.keyword.Action;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.support.FindBy;
import org.openqa.selenium.support.PageFactory;

/**
 * Created by chenmeng on 2016/7/26.
 */
public class MLoginPage {

    private Action action;

    @FindBy(xpath = "//input[@id='loginName']")
    private WebElement username;
    @FindBy(xpath = "//input[@id='password']")
    private WebElement password;
    @FindBy(xpath = "//div[@id='loginSubmit']/a")
    private WebElement loginBtn;
    @FindBy(xpath = "//a[text()='闪电注册']")
    private WebElement fastRegister;

    public MLoginPage(WebDriver driver,Action action){
        this.action = action;
        PageFactory.initElements(driver,this);
    }

    public void login(String user,String pass) throws Exception{
        action.inputText(username,user);
        action.inputText(password,pass);
        action.click(loginBtn);
    }
}
